/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vm.help;

import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Peer
 */
public class HelpTableModelHVM extends AbstractTableModel {

    Object[][] data = {{"' '","Do Nothing"},
                       {"p","Print S0 interpreted as an integer"},
                       {"P","Print S0 interpreted as an ASCII character"},
                       {"0..9","Push 0..9 on the Stack"},
                       {"+","Push S1 + S0"},
                       {"-","Push S1 - S0"},
                       {"*","Push S1 * S0"},
                       {"/","Push S1 / S0"},
                       {":","Push sgn(S1-S0) on the stack"},
                       {"g","Add S0 to the program counter"},
                       {"?","Add S0 to the program counter if S1 is 0"},
                       {"c","Push the program counter on the call stack and set the program counter to S0"},
                       {"$","Set the program counter to the value pop'ed from the call stack"},
                       {"<","Push the value of memory cell S0"},
                       {">","Store S1 into memory cell S0"},
                       {"^","Push a copy of S<S0+1> (ex: 0^ duplicates S0)"},
                       {"v","Remove S<S0+1> from the stack and push it on top (ex: 1v swaps S0 and S1)"},
                       {"d","Drop S0"},
                       {"!","Terminate the program"}};
    String[] header = {"Cmd","Description"};

    @Override
    public String getColumnName(int column) {
        return header[column];
    }

    public int getRowCount() {
        return data.length;
    }

    public int getColumnCount() {
        return header.length;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        return data[rowIndex][columnIndex];
    }
}
